#pragma once
#include "DirectX\Material.h"
#include "NeroGame\NFactory.h"

#ifdef DX_11
#include "DirectX\Device.h"

namespace Graphics
{
class ColorMaterial : public Graphics::Material
{
	RTTI_DECLARATIONS(ColorMaterial, Graphics::Material);
public:
	ColorMaterial(void);
	virtual ~ColorMaterial(void);
	virtual void Initialize();
	virtual void Deinitialize();
	virtual void Update(Graphics::RenderableEntity* entity);
	virtual void Render(Graphics::RenderableEntity* entity);

protected:
	bool InitializeShader(D3DDevice* device, HWND winHandle, const char* vertexShaderName, const char*  pixelShaderName);
	bool SetShaderParameters(D3DDevice* device, D3DXMATRIX worldMatrix, D3DXMATRIX viewMatrix, D3DXMATRIX projectionMatrix);
};
}
#elif defined(DX_9)
namespace Graphics
{
	class Shader;
	class RenderableEntity;
}

namespace Graphics
{
class ColorMaterial : public Graphics::Material
{
	RTTI_DECLARATIONS(ColorMaterial, Graphics::Material)
public:
	ColorMaterial(void);
	virtual ~ColorMaterial(void);
	virtual void Initialize();
	virtual void Deinitialize();
	virtual void Update(Graphics::RenderableEntity* entity);
	virtual void Render(Graphics::RenderableEntity* entity);

	MATERIAL_PARAM_DECLARATION(WorldViewProjection)
protected:
	virtual void BeginRender();
	virtual void EndRender();
};
}
#endif

ConcreteFactory(ColorMaterial, Graphics::Material, Graphics::ColorMaterial)